package com.sdk.pay.transfer.xposed;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;

public class WXHookHelper {
    public static void hookLog(LoadPackageParam arg0) {
        findAndHookMethod("com.alipay.alipaylogger.Log",
                arg0.classLoader, "d", String.class, String.class, new XC_MethodHook() {

                    @Override
                    protected void beforeHookedMethod(MethodHookParam param)
                            throws Throwable {
                        String para0 = (String) param.args[0];
                        String para1 = (String) param.args[1];
                        XposedBridge.log("hook wxlog d:" + para0 + "|"
                                + para1);
                    }
                });

        findAndHookMethod("com.alipay.alipaylogger.Log",
                arg0.classLoader, "e", String.class, String.class, new XC_MethodHook() {

                    @Override
                    protected void beforeHookedMethod(MethodHookParam param)
                            throws Throwable {
                        String para0 = (String) param.args[0];
                        String para1 = (String) param.args[1];
                        XposedBridge.log("hook wxlog e:" + para0 + "|"
                                + para1);
                    }
                });

        findAndHookMethod("com.alipay.alipaylogger.Log",
                arg0.classLoader, "i", String.class, String.class, new XC_MethodHook() {

                    @Override
                    protected void beforeHookedMethod(MethodHookParam param)
                            throws Throwable {
                        String para0 = (String) param.args[0];
                        String para1 = (String) param.args[1];
                        XposedBridge.log("hook wxlog i:" + para0 + "|"
                                + para1);
                    }
                });
        findAndHookMethod("com.alipay.alipaylogger.Log",
                arg0.classLoader, "v", String.class, String.class, new XC_MethodHook() {

                    @Override
                    protected void beforeHookedMethod(MethodHookParam param)
                            throws Throwable {
                        String para0 = (String) param.args[0];
                        String para1 = (String) param.args[1];
                        XposedBridge.log("hook wxlog v:" + para0 + "|"
                                + para1);
                    }
                });
        findAndHookMethod("com.alipay.alipaylogger.Log",
                arg0.classLoader, "w", String.class, String.class, new XC_MethodHook() {

                    @Override
                    protected void beforeHookedMethod(MethodHookParam param)
                            throws Throwable {
                        String para0 = (String) param.args[0];
                        String para1 = (String) param.args[1];
                        XposedBridge.log("hook wxlog w:" + para0 + "|"
                                + para1);
                    }
                });

    }
}
